package poler.business  
{  
    import com.salesforce.Connection;
    import com.salesforce.objects.LoginRequest;
    
    import mx.core.Application;
    import mx.rpc.IResponder;
    
    import poler.model.ModelLocator;   
  
    public class LoginServiceDelegate
    {  
        private var responder : IResponder;  
        private var service : Connection; 
          
        public function LoginServiceDelegate(responder : IResponder )  
        {  
            this.service = ModelLocator.getInstance().Apex;
            this.responder = responder;  
        }     
  
        public function login(un:String,pw:String):void  
        {  
        	var lr:LoginRequest = new LoginRequest();
        	if(un.length > 0 && pw.length > 0){
		     	lr.username = un;	//"pegvictoriano69@gmail.com";
		     	lr.password = pw;	//"poler666Ti3NO3txXpwtR4aQ813t43Wnd";
         	}else{
		     	lr.server_url = Application.application.parameters.server_url;
		     	lr.session_id = Application.application.parameters.session_id;
		     	
         	}
         	lr.callback = responder;
	        service.login(lr);
         	//
        }  
		// 
    }  
}     